package com.example.dao;

import com.example.entity.Orderdetail;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface OrderdetailDao {
    @Select("select * from orderdetail")
    ArrayList<Orderdetail> queryAll();

    @Delete("delete from orderdetail where odID = #{id}")
    int delectById(Integer id);

    @Select("select * from orderdetail where odID = #{id}")
    int selectByID(Integer id);

    @Select("select * from orderdetail where odID = #{id}")
    Orderdetail findByid(Integer id);

    @Update("UPDATE orderdetail SET" +
            "oID = #{orderdetail.oid}," +
            "gdID = #{orderdetail.gdid}," +
            "odNum = #{orderdetail.odnum}," +
            "dEvalution = #{orderdetail.devalution}," +
            "odTime = #{orderdetail.odtime}" +
            "WHERE odID = #{orderdetail.odid}")
    int update(@Param("orderdetail")Orderdetail orderdetail);

    @Insert("insert into orderdetail(oID,gdID,odNum,dEvalution,odTime)" +
            "values(#{orderdetail.odid}," +
            "#{orderdetail.oid}," +
            "#{orderdetail.gdid}," +
            "#{orderdetail.odnum}," +
            "#{orderdetail.devalution}," +
            "#{orderdetail.odtime})")
    int insert(@Param("orderdetail")Orderdetail orderdetail);


}
